package com.pug.config.mq;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Author: lqm
 * create: 2022/5/1 16:56
 * Lover: lqx
 *
 * @see
 */
@Configuration
public class UserChangeOrderTopic {
    public static final String LIU_ORDER_USER_EXCHANGE="liu.order.user.exchange_change";
    public static final String LIU_ORDER_USER_ROUTING_KEY="liu.order.user.routing.change";
    public static final String LIU_ORDER_USER_QUEUE="liu.order.user.queue.change";
    //创建普通交换机
    @Bean
    public Exchange UserExchange(){
        return new DirectExchange(LIU_ORDER_USER_EXCHANGE,true,false);
    }
    //创建普通队列
    @Bean
    public Queue UserQueue(){
        return new Queue(LIU_ORDER_USER_QUEUE,true,false,false);
    }
    @Bean
    public Binding a(){
        return BindingBuilder.bind(UserQueue()).to(UserExchange()).with(LIU_ORDER_USER_ROUTING_KEY).noargs();
    }
}
